package
{
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.utils.ByteArray;
	
	import mx.controls.Button;
	import mx.core.Application;

	public class MinerBase extends Application
	{
		public var mineBoard: MineBoard;
		public var btnTest: Button;
		
		public var gameId: String;
		
		public function MinerBase()
		{
			super();
			addEventListener(MinerEvent.GAME_STARTED, gameStarted);
		}
				
		override protected function createChildren():void {
			super.createChildren();
			btnTest.addEventListener(MouseEvent.CLICK, btnTestClick);
			mineBoard.setup(10, 10);
		}

		private function btnTestClick(event: Event): void {
			dispatchEvent(new StartGameEvent(10, 10, 10, 'lex', 'lex'));
			mineBoard.setup(10, 10);
		}
		
		private function gameStarted(event: GameStartedEvent): void {
			gameId = event.gameId;						
		}
	}
}